package thread;

public class SyncDemo3 {
    public static void main(String[] args) {
        StringBuilder sbd = new StringBuilder();
        StringBuffer sbf = new StringBuffer();
        Thread thread1 = new Thread(){
            @Override
            public void run() {
                for (int i=1;i<=10000;i++){
                    sbf.append("abc");
                }
            }
        };

        Thread thread2 = new Thread(){
            @Override
            public void run() {
                for (int i=1;i<=10000;i++){
                    sbf.append("abc");
                }
            }
        };

        thread1.start();
        thread2.start();
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println(sbf.length());
    }
}
